<?php
namespace app\controller\model;

use app\BaseController;
use think\facade\Db;

class Orders extends BaseController
{
    protected $tables;
    public function __construct(){
        $this->tables=new Tables();
    }
    public function ordersStatusStr($res=[]){
        if(!is_array($res) || count($res)<1){
            return $res;
        }
        foreach ($res as $k=>$v){
            if($v['afterSellStatus']<0){
                switch ($v['afterSellStatus']){
                    case -1:
                        $res[$k]['statusStr']="发起售后";
                        break;
                    case -2:
                        $res[$k]['statusStr']="待退货";
                        break;
                    case -3:
                        $res[$k]['statusStr']="待退款";
                        break;
                    case -4:
                        $res[$k]['statusStr']="退款完成";
                        break;
                    default:
                        $res[$k]['statusStr']="未知";
                }
            }else{
                switch ($v['status']){
                    case 0:
                        $res[$k]['statusStr']="待付款";
                        break;
                    case 1:
                        $res[$k]['statusStr']="待发货";
                        break;
                    case 2:
                        $res[$k]['statusStr']="待收货";
                        break;
                    case 3:
                        $res[$k]['statusStr']="已完成";
                        break;
                    case -1:
                        $res[$k]['statusStr']="发起退款";
                        break;
                    case -2:
                        $res[$k]['statusStr']="待退货";
                        break;
                    case -3:
                        $res[$k]['statusStr']="退款完成";
                        break;
                    default:
                        $res[$k]['statusStr']="未知";
                }
            }

            switch ($v['payWay']){
                case 0:
                    $res[$k]['payStr']="微信支付";
                    break;
                case 1:
                    $res[$k]['payStr']="余额支付";
                    break;
                case 2:
                    $res[$k]['payStr']="提现";
                    break;
                case 3:
                    $res[$k]['payStr']="推广";
                    break;
                default:
                    $res[$k]['statusStr']="未知";
            }
            if(isset($v['express'])){
                switch ($v['express']){
                    case 1:
                        $res[$k]['expressStr']="会员自提";
                        break;
                    default:
                        $res[$k]['expressStr']="快递发货";
                }
            }

        }
        return $res;
    }
}
?>